﻿using MediatR;
using S_Gridding.Api.Application.Commands.AssemType;
using S_Gridding.Infrastructure.Interface;

namespace S_Gridding.Api.Application.CommandsHanders.AssemType
{
    /// <summary>
    /// 逻辑删除部件类型信息
    /// </summary>
    public class AssemTypeFalseDeleteCommandHander : IRequestHandler<AssemTypeFalseDeleteCommand, int>
    {
        private readonly IAssemTypeRepository _assemTypeRepository;   //注入部件类型信息

        public AssemTypeFalseDeleteCommandHander(IAssemTypeRepository assemTypeRepository)
        {
            _assemTypeRepository = assemTypeRepository;
        }
        public async Task<int> Handle(AssemTypeFalseDeleteCommand request, CancellationToken cancellationToken)
        {
            var list = await _assemTypeRepository.GetFindAsync(request.AssemTypeId);
            list.IsDel = true;
            return await _assemTypeRepository.UpdateAsync(list);
        }
    }
}
